class Person:

  def __init__(self, name):
    self.name = name

  def setName(self, name):
    self.name = name
  
  def sayHi(self):
    print('Hi, my name is {}'.format(self.name))

Alex = Person('Alex')
Alex.sayHi()
# Hi, my name is Alex

Alex.setName('Wang')
Alex.sayHi()
# Hi, my name is Wang